from django.contrib.auth.backends import ModelBackend as AuthModelBackend


class ModelBackend(AuthModelBackend):
    """自定制认证后端，允许未激活账号通过认证，
    但是当用户试图登录的时候抛forms.ValidationError(AuthenticationForm)"""

    def user_can_authenticate(self, user):
        return True
